<template>
    <el-button type="warning" @click="onShop">{{data}}</el-button>
</template>

<script lang="ts" setup>
import { ref, watch } from 'vue';
import router from '../router';

const data = ref('去购买')
const id = ref(0)
const type = ref('')

const onShop = () => {
  router.push({ name: 'userPay', params: { type:type.value,id: id.value } })
}

const props = defineProps<{
    data:string
    type:string
    id:number
}>()

watch(props,()=>{
    data.value = props.data
    id.value = props.id
    type.value = props.type
},{ immediate: true })
</script>

<style scoped>
</style>
